public class Leetcode1663 {

    public static void main(String[] args) {
        System.out.println(getSmallestString(3, 27));
        System.out.println(getSmallestString(3, 27));
        System.out.println(getSmallestString(5, 73));
        System.out.println(getSmallestString(5, 130));
        System.out.println(getSmallestString(9, 34));
    }

    public static String getSmallestString(int n, int k) {
        return "a".repeat(Math.max(0, n - (int) Math.ceil((k - n) / 25.0))) + ((k - n) % 25 == 0 ? "" : (char) ('a' + (k - n) % 25)) + "z".repeat((k - n) / 25);
    }
}
